﻿using MyWeb.TaskGrpc.Models;
using System.Linq.Expressions;

namespace MyWeb.TaskGrpc.Context.Services
{
    /// <summary>
    /// 任务【数据库操作】
    /// </summary>
    public interface IJobsService
    {
        Task<bool> AddJob(Jobs model);
        Task<List<Jobs>> GetJobs(int page = 1, int pageSize = 20);

        /// <summary>
        /// 获取所有作业
        /// </summary>
        /// <returns></returns>
        Task<List<Jobs>> GetJobs(Expression<Func<Jobs, bool>> where);

        /// <summary>
        /// 删除任务
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<bool> Remove(Jobs model);

        /// <summary>
        /// 更新任务
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        Task<bool> Update(Jobs model);
        Task<bool> AddTaskLog(TaskLog log);
        Task<List<TaskLog>> GetTaskLog(long jobId, int page, int pageSize);
    }
}
